import React, { FC, useState } from "react";
import styles from './common.module.scss'
import {Typography} from "antd";
import {useTitle} from 'ahooks'
import QuestionCard from "../../components/QuestionCard.tsx";
const {Title} = Typography
const rawQuestionList = [
    { _id: 'q1', title: '问卷1', isPublished: false, isStar: true, answerCount: 5, createAt: '5月4日 13:23' },
    { _id: 'q2', title: '问卷2', isPublished: false, isStar: true, answerCount: 3, createAt: '5月4日 13:23' },
    { _id: 'q3', title: '问卷3', isPublished: false, isStar: false, answerCount: 2, createAt: '5月4日 13:23' },
    { _id: 'q4', title: '问卷4', isPublished: true, isStar: true, answerCount: 1, createAt: '5月4日 13:23' },
]

const List: FC = () => {
    useTitle('鹏宇问卷 - 我的问卷')
    const [questionList, setQuestionList] = useState(rawQuestionList)

    return (
        <div>
            <div className={styles.header}>
                <div >
                    <Title level={3}>我的问卷</Title>
                </div>
                <div className={styles.right}>（搜索）</div>
            </div>

            <div className={styles.content}>
                {/*{生成问卷列表}*/}
                {questionList.length > 0 && questionList.map(q=>{
                    const {_id} = q
                    return <QuestionCard key={_id} {...q}/>
                })}
            </div>

            <div className={styles.footer}>加载更多</div>
        </div>
    )
}

export default List